<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@include file="/common/page.jsp" %>    
<!DOCTYPE html>
<html>
<head>
<%@include file="/common/head.jsp" %>  
<link rel="stylesheet" type="text/css" href="${rootPath }/static/css/page.css" >
<title>后台管理</title>
<style type="text/css">
			.currentPage{
				cursor: not-allowed;
			}
			.currentPage a{
				pointer-events:none;
				background-color: rgba(123,23,3,0.2) !important;
				box-shadow: 0 0 0 0 rgb(0,0,0) !important;
			}
		</style>
</head>
<body>
<%@include file="/common/common-html.jsp" %> 
			<div class="cl pd-5 bg-1 bk-gray mt-20">
				<span class="l">
				<a class="btn btn-primary radius" href="${rootPath}/back/article-add.html"><i class="Hui-iconfont">&#xe600;</i> 写博客</a>
				</span>
				<span class="r">共有数据：<strong>${page.totalRecord}</strong> 条</span>
			</div>
			<div class="mt-20">
				<table class="table table-border table-bordered table-bg table-hover table-sort">
					<thead>
						<tr class="text-c">
							<!-- <th width="25"><input type="checkbox" name="" value=""></th> -->
							<th width="200">文章标题</th>
							<th>文章摘要</th>
							<th width="80">分类</th>
							<th width="120">创作时间</th>
							<th width="75">浏览次数</th>
							<th width="60">发布状态</th>
							<th width="120">操作</th>
						</tr>
					</thead>
					<tbody>
					<c:forEach items="${briefs }" var="brief">
					
						<tr class="text-c">
							<td><a href="" title="查看">${brief.title }</a></td>
							<td  class="text-l">${brief.summary }</td>
							<td>${brief.articleCategory.categoryName }</td>
							<td><fmt:formatDate value="${brief.publishTime }" pattern="yyyy-MM-dd HH:mm:ss"/> </td>
							<td>${brief.readNum }</td>
							<td class="td-status"><span class="label label-success radius">${brief.status==1?'已发布':'未发布' }</span></td>
							<td class="f-14 td-manage">
							<!-- <a style="text-decoration:none" onClick="article_stop(this,'10001')" href="javascript:;" title="下架"><i class="Hui-iconfont">&#xe6de;</i></a> -->
								<a style="text-decoration:none" class="ml-5" href="${rootPath}/back/article-edit.html?id=${brief.id }" title="编辑"><i class="Hui-iconfont">&#xe6df;</i></a>
								<a style="text-decoration:none" class="ml-5" onClick="article_del('${rootPath }/back/article-delete.html','${brief.id }')" href="javascript:;" title="删除"><i class="Hui-iconfont">&#xe6e2;</i></a></td>
						</tr>
					</c:forEach>
						
					</tbody>
				</table>
			</div>
		</article>
			<div style="text-align: center;">
				<ul id="menu">
					<li><a href="index.html?page=${page.prePage }">Prev</a></li>
					<c:set var="begin" value="${page.currentPage<=2?1:(page.currentPage+2<=page.totalPage?page.currentPage-2:page.totalPage-4)}"></c:set>
					
					<c:forEach begin="${begin<=0?1:begin}" end="${page.currentPage+2<=page.totalPage?(page.totalPage>5?begin+4:page.totalPage):page.totalPage }" var="p">
					<li class="${page.currentPage==p?'currentPage':'' }"><a href="index.html?page=${p }">${p }</a></li>
					</c:forEach>
					<li><a href="index.html?page=${page.nextPage }">Next</a></li>
			    </ul>
			</div>
	</div>
</section>			
<script type="text/javascript" src="${rootPath }/static/lib/jquery/1.9.1/jquery.min.js"></script> 
<script type="text/javascript" src="${rootPath }/static/lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="${rootPath }/static/h-ui/js/H-ui.js"></script> 
<script type="text/javascript" src="${rootPath }/static/h-ui.admin/js/H-ui.admin.page.js"></script> 
<script type="text/javascript">



/*资讯-添加*/
function article_add(title,url,w,h){
	var index = layer.open({
		type: 2,
		title: title,
		content: url
	});
	layer.full(index);
}
/*资讯-编辑*/
function article_edit(title,url,id,w,h){
	var index = layer.open({
		type: 2,
		title: title,
		content: url
	});
	layer.full(index);
}
/*资讯-删除*/
function article_del(url,id){
	layer.confirm('确认要删除吗？',function(index){
		$.ajax({
			type: 'POST',
			url: url+"?id="+id,
			success: function(){
				layer.msg('已删除!',{icon:1,time:1000});
				window.location.reload();
			},
			error:function(data) {
				console.log(data.msg);
			},
		});		
	});
}
</script>
</body>
</html>